package cn.java75.sp.web;

import cn.java75.sp.vo.AjaxResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author oldliu
 * @since 1.0
 */
@ControllerAdvice//(basePackages = "cn.java75.sp.web")
@ResponseBody
public class GlobalExceptionHandler {
    @ExceptionHandler(Exception.class)
    public AjaxResult handleException(Exception e){
        e.printStackTrace();
        return AjaxResult.error("发生错误："+e);
    }
}
